import axios from 'axios';
const dburl = 'https://www.easy-mock.com/mock/5cdbaeace9b2a1582749052a/example';
axios.defaults.baseURL = dburl;

// 获取用户信息
export const apiLogging = (id) => {
    return axios.get('/user', {
        params: { id }
    })
}

// 获取地址列表
export const apiAddressEdit = () => {
    return axios.get('/addressEdit')
}

// 登录接口
export const apiLogin = (phone, password) => {
    return axios.post('/login', {
        "phone": phone,
        "password": password
    })
}

// 获取商品列表
export const apiGetShopList = () => {
    return axios.get('/getShopList')
}

// 获取销量最高的商品列表
export const apiGetTopSelling = () => {
    return axios.get('/getTopSelling')
}

// 获取距离最近的商品列表
export const apiGetSDistance = () => {
    return axios.get('/getShortestDistance')
}

// 获得筛选后的商品列表
export const apiGetFilter = (name) => {
    return axios.post('/filterShopList', {
        "name": name
    })
}

// 获得商家详情
export const apiGetShopInfo = (id) => {
    return axios.get('/getShopInfo', {
        params: { id }
    })
}

// 获得商家评论
export const apiGetCommit = (category) => {
    return axios.get('/getCommit', {
        params: { category }
    })
}